﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteWithControlAccess.Master"
    Inherits="ProjetoComperio.SystemFramework.Web.ComperioViewPage<IQueryable<Event>>" %>

<%@ Import Namespace="ProjetoComperio.Framework.Web.Security.UrlEncrypt" %>
<%@ Import Namespace="ProjetoComperio.DataLayer.Entities" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Eventos
    </h2>
    <div align="right">
        <%= Html.ActionLink("Novo","Create","Event") %>
    </div>
    <div class="Grid">
        <%= Html.Grid(ViewData.Model).Columns(
           column => 
           {  
            column.For(x => x.Title).Named("Título");
            column.For(x => x.StartDate.ToString("dd/MM/yyyy")).Named("Data de Início");
            column.For(x => x.EndDate.ToString("dd/MM/yyyy")).Named("Data de Término");
            
               column.For(x => Html.ActionLink("Editar", "Edit", new { id = URLEncrypt.EncryptToString(x.ContributionID.ToString()) })
                   ).DoNotEncode().Attributes(x => new Hash(style => "font-weight:bold")).CellCondition(x => x.IsActive == true);

               column.For(x => x.IsActive ? "Sim" : "Não").Named("Ativa?");
               
           }).Attributes(Style =>  "width:100%").Empty("Não existem eventos cadastrados.")
           
        %>
    </div>
    <br />
    <br />
</asp:Content>
